<?php
require_once  __DIR__ . '/includes/authenticate.php';

if (isset($_SESSION['user_key'])) {

include_once __DIR__ . '/db_bb_connect.php';

require_once __DIR__ . '/includes/BasketbalFunctions.php';

$basketbalfunctions = new BasketbalFunctions();

$username = $_SESSION['username'];
$playerID = $_SESSION['user_key'];

$sql = "SELECT firstname, lastname, type, user_key FROM users WHERE username = '$username'";

$row = $basketbalfunctions->FetchResults($sql);

$firstname = $row['firstname']; 
$lastname = $row['lastname']; 
$type = $row['type'];

$_SESSION['type'] = $type;
$_SESSION['firstname'] = $firstname;
$_SESSION['lastname'] = $lastname;
  
?>

<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta charset="utf-8">
	<title>Basketbal <?= $type; ?> <?= $firstname; ?> <?= $lastname; ?></title>

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
  <link rel="stylesheet" type="text/css" href="./css/style.css">

  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tokenfield/0.12.0/css/bootstrap-tokenfield.min.css">

  <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tokenfield/0.12.0/bootstrap-tokenfield.js"></script>
  <script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap.min.js"></script>
  <script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
  <script type="text/javascript" src="./js/bootstrap-tabcollapse.js"></script>
  <script type="text/javascript" src="./js/functions.js"></script>

 <link rel="icon" href="./images/basketball2.png" type="image/png"> 
</head>
<body>

<br>
<nav class="navbar navbar-inverse navbar-fixed-top navbar-expand-xl">
  <div class="container-fluid">
    <div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#"><?= $firstname; ?> <?= $lastname; ?></a>
    </div>
    <div class="collapse navbar-collapse" id="myNavbar">
    <ul class="nav navbar-nav">
    	<?php

if ($type === 'Coach') { ?>

	<li><a href="./home_coach.php" class="mainpagebutton">Home</a></li>
  
	   <li class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">Feedforward
      <span class="caret"></span>
    </a>
    <ul class="dropdown-menu">
              <li><a class="mainpagebutton" href="./actionpoints_team.php">Team Actionpoints</a></li>
              <li class="divider"></li>
              <li><a class="mainpagebutton" href="./video_feedback_overview.php">Feedforward Video Overview</a></li>
              <li><a class="mainpagebutton" href="./video_other_overview.php">Other Video Overview</a></li>
              <li><a class="mainpagebutton" href="./video_feedback_search.php">Search Video Feedback</a></li>              
              <li class="divider"></li>
              <li><a class="mainpagebutton" href="./video_feedback_add.php">Add Video Feedback</a></li>
              <li><a class="mainpagebutton" href="./video_other_add.php">Add Other Video</a></li>              
              <li><a class="mainpagebutton" href="./video_feedback_add_new_actiontags.php">Add Video Feedback Tags</a></li>             
              <li class="divider"></li>
              <li><a class="mainpagebutton" href="./articles_archive.php">Articles Archive</a></li>
              <li><a class="mainpagebutton" href="./article_add.php">Add Article</a></li>
    </ul>
  </li>

 

  <li class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">Game
      <span class="caret"></span>
    </a>
    <ul class="dropdown-menu">
      <li><a href="#" name="game_stats_archive" class="mainpagebutton">Game Stats Archive</a></li>
      <li><a class="mainpagebutton" href="./admin_viewgamecomment.php" >View Game Comment</a></li>
      <li class="divider"></li>
      <li><a class="mainpagebutton" href="./addstats_bytotals.php">Add Game Stats - Totals</a></li>
      <li><a class="mainpagebutton" href="./addstats_byquarter.php">Add Game Stats - By Quarter</a></li>
      <li><a class="mainpagebutton" href="./admin_addeditgameresults.php" >Add/Edit Game Result</a></li>
      <li><a class="mainpagebutton" href="./admin_addeditgamecomment.php" >Add/Edit Game Comment</a></li>
    </ul>
  </li>
  <li class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">Training
      <span class="caret"></span>
    </a>
    <ul class="dropdown-menu">
      <li><a class="mainpagebutton" href="./training_viewpresence.php" >View Presence - Single Training</a></li>
      <li><a class="mainpagebutton" href="./training_viewpresenceweek.php" >View Presence - Week</a></li>
      <li><a class="mainpagebutton" href="./training_viewpresencecumu.php" >View Presence - Season</a></li>
      <li><a class="mainpagebutton" href="./training_viewftstatsweek.php" >View FT Stats - Week</a></li>
      <li><a class="mainpagebutton" href="./training_viewftstatscumu.php" >View FT Stats -  Season</a></li>
      <li><a class="mainpagebutton" href="./training_viewftladderstats.php" >View FT-ladder Stats - Season</a></li>
      <li><a class="mainpagebutton" href="./training_viewshuttlerunplayerstats.php" >View Shuttle-run Stats - Player</a></li>
      <li><a class="mainpagebutton" href="./training_viewshuttlerunteamstats.php" >View Shuttle-run Stats - Team</a></li>
      <li><a class="mainpagebutton" href="./training_viewgeninfo.php" >View General Training Info</a></li>
      <li class="divider"></li>
      <li><a class="mainpagebutton" href="./training_addpresence.php" >Add Presence Stats</a></li>
      <li><a class="mainpagebutton" href="./training_addftstats.php" >Add FT Stats</a></li>
      <li><a class="mainpagebutton" href="./training_addftladderstats.php" >Add FT-ladder Stats</a></li>
      <li><a class="mainpagebutton" href="./training_addshuttlerunstats.php" >Add Shuttle-run Stats</a></li>
      <li><a class="mainpagebutton" href="./training_addgeninfo.php" >Add General Training Info</a></li>
      

    </ul>
  </li>
<li class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">Player
      <span class="caret"></span>
    </a>
    <ul class="dropdown-menu">
      <li><a href="./playerprofile.php" class="mainpagebutton">Player Profiles</a></li>
      <li><a class="mainpagebutton" href="./home_player_admin.php">Player Home Viewer</a></li>
      <li><a class="mainpagebutton" href="./article_overview_player_loader_admin.php">Player Article Viewer</a></li>
    </ul>
  </li>


  <li class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="./.php">Other Tools
      <span class="caret"></span>
    </a>
    <ul class="dropdown-menu">              
              <li><a class="mainpagebutton" href="./opponents.php" >Opponent Info View/Add</a></li>
              <li class="divider"></li>
              <li><a class="mainpagebutton" href="./admin_addgametoseason.php" name="">Add Game to Season</a></li>             
              <li><a class="mainpagebutton" href="./admin_addplayertocoachteam.php" name="">Add Player to Coachteam</a></li>
               <li><a class="mainpagebutton" href="./admin_addplayertoopponent.php" name="">Add Player to Opponent team</a></li>
               <li><a class="mainpagebutton" href="./admin_addopptoseason.php" name="">Add Opponent to Season</a></li>
               <li class="divider"></li>
               <li><a class="mainpagebutton" href="./admin_addnewplayer.php" name="">Add New Player</a></li>
               <li><a class="mainpagebutton" href="./admin_addnewteam.php" name="">Add New Team</a></li>                           
              <li><a class="mainpagebutton" href="./admin_addnewseason.php" name="">Add New Season</a></li>
              <li class="divider"></li>
              <li><a class="mainpagebutton" href="./teaminfo.php" name="">Teams Overview</a></li>
              <li><a class="mainpagebutton" href="./serverlog.php" name="">Server Log</a></li>
    </ul>
  </li>

<?php 

}

?>
      
    </ul>
    <ul class="nav navbar-nav navbar-right">
      <li>
        <a href="./settings.php" class="mainpagebutton"> Settings</a>
      </li>
      <li>
           <a href="#" id="logout"  class="mainpagebutton">
            <span class="glyphicon glyphicon-log-in"></span> 
            Logout</a>
      </li>
    </ul>
  </div>
  </div>
</nav>

<br><br>
<div id="content"> </div>

</body>
</html>

<?php 

	
} else {
	echo "nothing here";
}

?>